package behavior.chain.impl;

import java.util.Iterator;
import java.util.List;

import behavior.chain.Filter;
import behavior.chain.FilterChain;

public class FilterChainImpl implements FilterChain{
	
	private List<Filter> filters;
		
	public FilterChainImpl(List<Filter> filters){
		this.filters = filters;
	}

	@Override
	public void doFilter(Object request, Object response) {
		Iterator<Filter> it = this.filters.iterator();
		while(it.hasNext()){
			Filter next = it.next();
			next.doFilter(request, response, this);
		}
	}

}
